package com.colin.app.activity.senior.process;

import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.colin.app.R;
import com.colin.app.activity.senior.SeniorContract;
import com.colin.app.activity.senior.SeniorPresenterImpl;
import com.colin.app.app.AppActivity;
import com.colin.app.bean.DemoBean;
import com.colin.library.other.Url;

public class MultiProcessActivity extends AppActivity implements SeniorContract.SeniorView{
    private SeniorContract.SeniorPresenter mSeniorPresenter = null;
    @Override
    protected void onDestroy() {
        if (null != mSeniorPresenter) {
            mSeniorPresenter.destroy();
            mSeniorPresenter = null;
        }
        super.onDestroy();
    }

    @Override
    public void initPresenter() {
        DemoBean demoBean = getIntent().getExtras().getParcelable("clazz");
        mSeniorPresenter = new SeniorPresenterImpl(this, this, demoBean);
    }


    @Override
    public int initViewLayoutID() {
        return R.layout.activity_multi_process;
    }

    @Override
    public void initView() {

    }
    @Override
    public void initData() {
        mSeniorPresenter.setData();
    }

    public void whatProcess(View view){
        mSeniorPresenter.showAlertProcess();
    }

    public void whatThread(View view){
        mSeniorPresenter.showAlertThread();
    }

    public void summary(View view){
        mSeniorPresenter.showAlertSummary();
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_to_url, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.action_to_web:
                mSeniorPresenter.toWebViewActivity(Url.URL_PROCESS);
                break;
            default:
                return super.onOptionsItemSelected(item);
        }
        return super.onOptionsItemSelected(item);
    }
}
